Imports System.Windows.Forms

Public Class dlgRegister

    Private Sub OK_Button_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles OK_Button.Click
        Me.DialogResult = System.Windows.Forms.DialogResult.OK
        If Me.TextBox1.Text = frmMain.RegKey And Me.TextBox1.Enabled = True Then
            My.Settings.RegKey = Me.TextBox1.Text
            MsgBox("Thank you for registering this product")
        Else
            If Me.TextBox1.Enabled = True Then
                MsgBox("The key you entered is NOT correct")
            End If
        End If
        Me.Close()
    End Sub

    Private Sub Cancel_Button_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Cancel_Button.Click
        Me.DialogResult = System.Windows.Forms.DialogResult.Cancel
        Me.Close()
    End Sub

    Private Sub dlgRegister_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        If My.Settings.RegKey = frmMain.RegKey Then
            Me.Label1.Text = "This product is already registered. Thank you!"
            Me.TextBox1.Enabled = False
            Me.TextBox1.Text = My.Settings.RegKey
        End If
    End Sub
End Class
